import request from '../utils/request'

export const pay = (openid) => {
    return request(
        '/order/pay',
        {
            method: 'POST',
            data: {
                openid
            }
        }
    )
}

// 曾
export const create = (data) => request(
    '/order',
    { method: 'PUT', data }
)

// 改
export const update = (data) => request(
    '/order',
    {
        method: 'POST',
        data
    }
)
// 查
export const find = (openid, status) => {
    let params = `openid=${openid}`
    if (status) {
        params += `&status=${status}`
    }
    return request(
        `/order?${params}`
    )
}
